Imports AppliedRecognition.Util

Friend Class ConfigForm
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.

    Friend WithEvents chkRunAtStartup As System.Windows.Forms.CheckBox
    Friend WithEvents cboDispatch As System.Windows.Forms.ComboBox
    Friend WithEvents cboSpeech As System.Windows.Forms.ComboBox
    Friend WithEvents cboResize As System.Windows.Forms.ComboBox
    Friend WithEvents cboQS As System.Windows.Forms.ComboBox
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents numDisplay As System.Windows.Forms.NumericUpDown
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents numExtended As System.Windows.Forms.NumericUpDown
    Friend WithEvents chkDebugWindows As System.Windows.Forms.CheckBox
    Friend WithEvents fntDlg As System.Windows.Forms.FontDialog
    Friend WithEvents chkShowSystry As System.Windows.Forms.CheckBox
    Friend WithEvents Label7 As System.Windows.Forms.Label
    Friend WithEvents numSplashScreen As System.Windows.Forms.NumericUpDown
    Friend WithEvents chkDebugWindowsCaptureScreenshot As System.Windows.Forms.CheckBox
    Friend WithEvents btnOk As System.Windows.Forms.Button
    Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
    Friend WithEvents llDebugDir As System.Windows.Forms.LinkLabel
    Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox
    Friend WithEvents GroupBox5 As System.Windows.Forms.GroupBox
    Friend WithEvents btnUpload As System.Windows.Forms.Button
    Friend WithEvents MM As System.Windows.Forms.MainMenu
    Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
    Friend WithEvents MIAbout As System.Windows.Forms.MenuItem
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.chkRunAtStartup = New System.Windows.Forms.CheckBox
        Me.GroupBox2 = New System.Windows.Forms.GroupBox
        Me.Label6 = New System.Windows.Forms.Label
        Me.numExtended = New System.Windows.Forms.NumericUpDown
        Me.Label5 = New System.Windows.Forms.Label
        Me.numDisplay = New System.Windows.Forms.NumericUpDown
        Me.Label7 = New System.Windows.Forms.Label
        Me.numSplashScreen = New System.Windows.Forms.NumericUpDown
        Me.chkShowSystry = New System.Windows.Forms.CheckBox
        Me.llDebugDir = New System.Windows.Forms.LinkLabel
        Me.chkDebugWindowsCaptureScreenshot = New System.Windows.Forms.CheckBox
        Me.chkDebugWindows = New System.Windows.Forms.CheckBox
        Me.GroupBox1 = New System.Windows.Forms.GroupBox
        Me.Label4 = New System.Windows.Forms.Label
        Me.Label3 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.Label1 = New System.Windows.Forms.Label
        Me.cboSpeech = New System.Windows.Forms.ComboBox
        Me.cboResize = New System.Windows.Forms.ComboBox
        Me.cboQS = New System.Windows.Forms.ComboBox
        Me.cboDispatch = New System.Windows.Forms.ComboBox
        Me.fntDlg = New System.Windows.Forms.FontDialog
        Me.btnOk = New System.Windows.Forms.Button
        Me.GroupBox3 = New System.Windows.Forms.GroupBox
        Me.btnUpload = New System.Windows.Forms.Button
        Me.GroupBox5 = New System.Windows.Forms.GroupBox
        Me.MM = New System.Windows.Forms.MainMenu
        Me.MenuItem1 = New System.Windows.Forms.MenuItem
        Me.MIAbout = New System.Windows.Forms.MenuItem
        Me.GroupBox2.SuspendLayout()
        CType(Me.numExtended, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.numDisplay, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.numSplashScreen, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.GroupBox1.SuspendLayout()
        Me.GroupBox3.SuspendLayout()
        Me.GroupBox5.SuspendLayout()
        Me.SuspendLayout()
        '
        'chkRunAtStartup
        '
        Me.chkRunAtStartup.Location = New System.Drawing.Point(8, 52)
        Me.chkRunAtStartup.Name = "chkRunAtStartup"
        Me.chkRunAtStartup.Size = New System.Drawing.Size(304, 24)
        Me.chkRunAtStartup.TabIndex = 2
        Me.chkRunAtStartup.Text = "Start QuickSwitch when I start Windows"
        '
        'GroupBox2
        '
        Me.GroupBox2.Controls.Add(Me.Label6)
        Me.GroupBox2.Controls.Add(Me.numExtended)
        Me.GroupBox2.Controls.Add(Me.Label5)
        Me.GroupBox2.Controls.Add(Me.numDisplay)
        Me.GroupBox2.Location = New System.Drawing.Point(-112, 608)
        Me.GroupBox2.Name = "GroupBox2"
        Me.GroupBox2.Size = New System.Drawing.Size(328, 112)
        Me.GroupBox2.TabIndex = 22
        Me.GroupBox2.TabStop = False
        Me.GroupBox2.Text = "Task Menu options"
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(112, 64)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(224, 24)
        Me.Label6.TabIndex = 17
        Me.Label6.Text = "Extended display duration (ms)"
        '
        'numExtended
        '
        Me.numExtended.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.numExtended.Increment = New Decimal(New Integer() {500, 0, 0, 0})
        Me.numExtended.Location = New System.Drawing.Point(16, 64)
        Me.numExtended.Maximum = New Decimal(New Integer() {100000, 0, 0, 0})
        Me.numExtended.Minimum = New Decimal(New Integer() {500, 0, 0, 0})
        Me.numExtended.Name = "numExtended"
        Me.numExtended.Size = New System.Drawing.Size(88, 24)
        Me.numExtended.TabIndex = 16
        Me.numExtended.Value = New Decimal(New Integer() {500, 0, 0, 0})
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(96, 32)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(184, 24)
        Me.Label5.TabIndex = 15
        Me.Label5.Text = "Display duration (ms)"
        '
        'numDisplay
        '
        Me.numDisplay.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.numDisplay.Increment = New Decimal(New Integer() {500, 0, 0, 0})
        Me.numDisplay.Location = New System.Drawing.Point(8, 32)
        Me.numDisplay.Maximum = New Decimal(New Integer() {100000, 0, 0, 0})
        Me.numDisplay.Minimum = New Decimal(New Integer() {500, 0, 0, 0})
        Me.numDisplay.Name = "numDisplay"
        Me.numDisplay.Size = New System.Drawing.Size(88, 24)
        Me.numDisplay.TabIndex = 14
        Me.numDisplay.Value = New Decimal(New Integer() {500, 0, 0, 0})
        '
        'Label7
        '
        Me.Label7.Location = New System.Drawing.Point(104, 80)
        Me.Label7.Name = "Label7"
        Me.Label7.Size = New System.Drawing.Size(184, 24)
        Me.Label7.TabIndex = 21
        Me.Label7.Text = "Splash screen duration"
        '
        'numSplashScreen
        '
        Me.numSplashScreen.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.numSplashScreen.Increment = New Decimal(New Integer() {500, 0, 0, 0})
        Me.numSplashScreen.Location = New System.Drawing.Point(8, 80)
        Me.numSplashScreen.Maximum = New Decimal(New Integer() {100000, 0, 0, 0})
        Me.numSplashScreen.Name = "numSplashScreen"
        Me.numSplashScreen.Size = New System.Drawing.Size(88, 24)
        Me.numSplashScreen.TabIndex = 3
        '
        'chkShowSystry
        '
        Me.chkShowSystry.Location = New System.Drawing.Point(8, 24)
        Me.chkShowSystry.Name = "chkShowSystry"
        Me.chkShowSystry.Size = New System.Drawing.Size(320, 24)
        Me.chkShowSystry.TabIndex = 1
        Me.chkShowSystry.Text = "Show QuickSwitch icon in System tray"
        '
        'llDebugDir
        '
        Me.llDebugDir.Location = New System.Drawing.Point(264, 56)
        Me.llDebugDir.Name = "llDebugDir"
        Me.llDebugDir.Size = New System.Drawing.Size(176, 23)
        Me.llDebugDir.TabIndex = 3
        Me.llDebugDir.TabStop = True
        Me.llDebugDir.Text = "Explore debug directory"
        '
        'chkDebugWindowsCaptureScreenshot
        '
        Me.chkDebugWindowsCaptureScreenshot.Location = New System.Drawing.Point(56, 56)
        Me.chkDebugWindowsCaptureScreenshot.Name = "chkDebugWindowsCaptureScreenshot"
        Me.chkDebugWindowsCaptureScreenshot.Size = New System.Drawing.Size(176, 24)
        Me.chkDebugWindowsCaptureScreenshot.TabIndex = 1
        Me.chkDebugWindowsCaptureScreenshot.Text = "Capture screen shot"
        '
        'chkDebugWindows
        '
        Me.chkDebugWindows.Location = New System.Drawing.Point(32, 24)
        Me.chkDebugWindows.Name = "chkDebugWindows"
        Me.chkDebugWindows.Size = New System.Drawing.Size(216, 24)
        Me.chkDebugWindows.TabIndex = 0
        Me.chkDebugWindows.Text = "Capture window information"
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.Add(Me.Label4)
        Me.GroupBox1.Controls.Add(Me.Label3)
        Me.GroupBox1.Controls.Add(Me.Label2)
        Me.GroupBox1.Controls.Add(Me.Label1)
        Me.GroupBox1.Controls.Add(Me.cboSpeech)
        Me.GroupBox1.Controls.Add(Me.cboResize)
        Me.GroupBox1.Controls.Add(Me.cboQS)
        Me.GroupBox1.Controls.Add(Me.cboDispatch)
        Me.GroupBox1.Location = New System.Drawing.Point(16, 96)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(392, 176)
        Me.GroupBox1.TabIndex = 1
        Me.GroupBox1.TabStop = False
        Me.GroupBox1.Text = "Trace levels"
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(8, 134)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(144, 23)
        Me.Label4.TabIndex = 13
        Me.Label4.Text = "Speech trace level"
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(8, 100)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(144, 23)
        Me.Label3.TabIndex = 12
        Me.Label3.Text = "Resize trace level"
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(8, 66)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(152, 23)
        Me.Label2.TabIndex = 11
        Me.Label2.Text = "Task switch level"
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(8, 32)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(144, 23)
        Me.Label1.TabIndex = 10
        Me.Label1.Text = "Dispatch trace level"
        '
        'cboSpeech
        '
        Me.cboSpeech.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cboSpeech.Location = New System.Drawing.Point(160, 134)
        Me.cboSpeech.Name = "cboSpeech"
        Me.cboSpeech.Size = New System.Drawing.Size(121, 26)
        Me.cboSpeech.TabIndex = 3
        '
        'cboResize
        '
        Me.cboResize.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cboResize.Location = New System.Drawing.Point(160, 100)
        Me.cboResize.Name = "cboResize"
        Me.cboResize.Size = New System.Drawing.Size(121, 26)
        Me.cboResize.TabIndex = 2
        '
        'cboQS
        '
        Me.cboQS.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cboQS.Location = New System.Drawing.Point(160, 66)
        Me.cboQS.Name = "cboQS"
        Me.cboQS.Size = New System.Drawing.Size(121, 26)
        Me.cboQS.TabIndex = 1
        '
        'cboDispatch
        '
        Me.cboDispatch.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cboDispatch.Location = New System.Drawing.Point(160, 32)
        Me.cboDispatch.Name = "cboDispatch"
        Me.cboDispatch.Size = New System.Drawing.Size(121, 26)
        Me.cboDispatch.TabIndex = 0
        '
        'btnOk
        '
        Me.btnOk.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.btnOk.Location = New System.Drawing.Point(384, 440)
        Me.btnOk.Name = "btnOk"
        Me.btnOk.TabIndex = 2
        Me.btnOk.Text = "Ok"
        '
        'GroupBox3
        '
        Me.GroupBox3.Controls.Add(Me.btnUpload)
        Me.GroupBox3.Controls.Add(Me.chkDebugWindowsCaptureScreenshot)
        Me.GroupBox3.Controls.Add(Me.chkDebugWindows)
        Me.GroupBox3.Controls.Add(Me.llDebugDir)
        Me.GroupBox3.Controls.Add(Me.GroupBox1)
        Me.GroupBox3.Location = New System.Drawing.Point(8, 144)
        Me.GroupBox3.Name = "GroupBox3"
        Me.GroupBox3.Size = New System.Drawing.Size(456, 288)
        Me.GroupBox3.TabIndex = 1
        Me.GroupBox3.TabStop = False
        Me.GroupBox3.Text = "Debug"
        '
        'btnUpload
        '
        Me.btnUpload.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnUpload.Location = New System.Drawing.Point(320, 24)
        Me.btnUpload.Name = "btnUpload"
        Me.btnUpload.Size = New System.Drawing.Size(112, 23)
        Me.btnUpload.TabIndex = 2
        Me.btnUpload.Text = "Upload debug data"
        '
        'GroupBox5
        '
        Me.GroupBox5.Controls.Add(Me.chkRunAtStartup)
        Me.GroupBox5.Controls.Add(Me.Label7)
        Me.GroupBox5.Controls.Add(Me.numSplashScreen)
        Me.GroupBox5.Controls.Add(Me.chkShowSystry)
        Me.GroupBox5.Location = New System.Drawing.Point(8, 8)
        Me.GroupBox5.Name = "GroupBox5"
        Me.GroupBox5.Size = New System.Drawing.Size(456, 120)
        Me.GroupBox5.TabIndex = 0
        Me.GroupBox5.TabStop = False
        Me.GroupBox5.Text = "Configuration"
        '
        'MM
        '
        Me.MM.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1})
        '
        'MenuItem1
        '
        Me.MenuItem1.Index = 0
        Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MIAbout})
        Me.MenuItem1.Text = "&Help"
        '
        'MIAbout
        '
        Me.MIAbout.Index = 0
        Me.MIAbout.Text = "&About"
        '
        'ConfigForm
        '
        Me.AcceptButton = Me.btnOk
        Me.AccessibleDescription = "QuickSwitch config form"
        Me.AccessibleName = "Config"
        Me.AutoScaleBaseSize = New System.Drawing.Size(7, 17)
        Me.CancelButton = Me.btnOk
        Me.ClientSize = New System.Drawing.Size(472, 474)
        Me.Controls.Add(Me.GroupBox5)
        Me.Controls.Add(Me.GroupBox3)
        Me.Controls.Add(Me.btnOk)
        Me.Controls.Add(Me.GroupBox2)
        Me.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.MaximizeBox = False
        Me.Menu = Me.MM
        Me.MinimizeBox = False
        Me.Name = "ConfigForm"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "QuickSwitch Configuration Options"
        Me.GroupBox2.ResumeLayout(False)
        CType(Me.numExtended, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.numDisplay, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.numSplashScreen, System.ComponentModel.ISupportInitialize).EndInit()
        Me.GroupBox1.ResumeLayout(False)
        Me.GroupBox3.ResumeLayout(False)
        Me.GroupBox5.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Public ReadOnly Property Dispatch() As CommandDispatch
        Get
            Return CommandDispatch.DefaultInstance
        End Get
    End Property

    Private Sub New()
        MyBase.New()
        InitializeComponent()
    End Sub


#Region "Singlton"

    Private Shared _instance As ConfigForm = Nothing
    Private Shared _lock As Object = New Object

    Public Shared ReadOnly Property Instance() As ConfigForm
        Get
            If _instance Is Nothing Then
                SyncLock _lock
                    If _instance Is Nothing Then
                        _instance = New ConfigForm
                    End If
                End SyncLock
            End If
            Return _instance
        End Get
    End Property
    Private Sub Form_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed
        _instance = Nothing
    End Sub
    Public Shared ReadOnly Property Exists() As Boolean
        Get
            If _instance Is Nothing Then Return False
            Return True
        End Get
    End Property
#End Region


    Dim cfg As QuickSwitchConfig
    Private Sub chkRunAtStartup_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkRunAtStartup.CheckedChanged
        If _init Then Exit Sub
        cfg.RunAtStartup = chkRunAtStartup.Checked
    End Sub
    Private Sub chkDebugWindows_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkDebugWindows.CheckedChanged
        If _init Then Exit Sub
        My.MySettings.Default.DebugWindows = chkDebugWindows.Checked
    End Sub

    Private Sub chkShowSystry_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkShowSystry.CheckedChanged
        If _init Then Exit Sub
        My.MySettings.Default.ShowSystrayIcon = chkShowSystry.Checked
    End Sub

    Private Sub numDisplay_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles numDisplay.ValueChanged
        If _init Then Exit Sub
        My.MySettings.Default.DisplayTimout = CInt(numDisplay.Value)
    End Sub
    Private Sub numExtended_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles numExtended.ValueChanged
        If _init Then Exit Sub
        My.MySettings.Default.HelpDisplayTimeout = CInt(numExtended.Value)
    End Sub
    Private Sub numSplashScreen_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles numSplashScreen.ValueChanged
        If _init Then Exit Sub
        My.MySettings.Default.SplashScreenDuration = CInt(numSplashScreen.Value)
    End Sub

    Private Sub chkDebugWindowsCaptureScreenshot_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkDebugWindowsCaptureScreenshot.CheckedChanged
        If _init Then Exit Sub
        My.MySettings.Default.DebugWindowsCaptureScreenshot = chkDebugWindowsCaptureScreenshot.Checked
    End Sub



    Private _init As Boolean = True

    Private Sub ConfigForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Util.Misc.EnableVisualStyles(Me)

        Me.Icon = QSRes.QSIcon
        cfg = Dispatch.Cfg

        chkRunAtStartup.Checked = cfg.RunAtStartup

        chkDebugWindows.Checked = My.MySettings.Default.DebugWindows
        chkShowSystry.Checked = My.MySettings.Default.ShowSystrayIcon
        chkDebugWindowsCaptureScreenshot.Checked = My.MySettings.Default.DebugWindowsCaptureScreenshot
        numDisplay.Value = My.MySettings.Default.DisplayTimout
        numExtended.Value = My.MySettings.Default.HelpDisplayTimeout
        numSplashScreen.Value = My.MySettings.Default.SplashScreenDuration

        cboDispatch.Items.AddRange([Enum].GetNames(GetType(TraceLevel)))
        cboDispatch.SelectedIndex = My.MySettings.Default.DispatchTraceLevel

        cboQS.Items.AddRange([Enum].GetNames(GetType(TraceLevel)))
        cboQS.SelectedIndex = My.MySettings.Default.QSTraceLevel

        cboResize.Items.AddRange([Enum].GetNames(GetType(TraceLevel)))
        cboResize.SelectedIndex = My.MySettings.Default.ResizeTraceLevel

        cboSpeech.Items.AddRange([Enum].GetNames(GetType(TraceLevel)))
        cboSpeech.SelectedIndex = My.MySettings.Default.SpeechTraceLevel

        '        updateFontDisplay(My.MySettings.Default.NumFont)

        _init = False
    End Sub

    Private Sub cboDispatch_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboDispatch.SelectedIndexChanged
        If _init Then Exit Sub
        My.MySettings.Default.DispatchTraceLevel = GetValFromCbo(cboDispatch.SelectedItem)
    End Sub

    Private Sub cboQS_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboQS.SelectedIndexChanged
        If _init Then Exit Sub
        My.MySettings.Default.QSTraceLevel = GetValFromCbo(cboQS.SelectedItem)
    End Sub
    Private Sub cboResize_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboResize.SelectedIndexChanged
        If _init Then Exit Sub
        My.MySettings.Default.ResizeTraceLevel = GetValFromCbo(cboResize.SelectedItem)
    End Sub
    Private Sub cboSpeech_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboSpeech.SelectedIndexChanged
        If _init Then Exit Sub
        My.MySettings.Default.SpeechTraceLevel = GetValFromCbo(cboSpeech.SelectedItem)
    End Sub

    Private Function GetValFromCbo(ByVal val As Object) As TraceLevel
        If val Is Nothing Then Return TraceLevel.Off
        Return DirectCast([Enum].Parse(GetType(TraceLevel), val.ToString, True), TraceLevel)
    End Function

    Private Sub cmdChooseFont_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If fntDlg.ShowDialog(Me) = Windows.Forms.DialogResult.OK Then
            My.MySettings.Default.NumFontFamily = fntDlg.Font.FontFamily.Name
            My.MySettings.Default.NumFontSize = CInt(fntDlg.Font.Size)
        End If
    End Sub

    Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
        Me.Close()
    End Sub


    Private Sub llDebugDir_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles llDebugDir.LinkClicked
        Windows.Forms.Cursor.Current = Cursors.WaitCursor
        System.Diagnostics.Process.Start(cfg.DebugDataPath)
        Windows.Forms.Cursor.Current = Cursors.Arrow
    End Sub


    Private Sub MIAbout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MIAbout.Click
        Dim f As New AboutForm
        f.ShowDialog(Me)
    End Sub
End Class
